package com.lmt.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Controller
 * Date 2018/07/21
 *
 * @author MT-Lin
 */
@RestController
public class MessageController {

    private Logger logger = LoggerFactory.getLogger(this.getClass());
    private String port;

    @Autowired
    public MessageController(Environment environment){
        this.port = environment.getProperty("server.port");
    }

    @RequestMapping("/getMessage")
    public String getMessage(){
        String name = "this is from provider-consul-two";
        logger.warn("provider-consul-one->getMessage(PORT[{}]) Message:{}", port, "this is from provider-consul-two.");
        return name;
    }
}
